﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace QuanLyHocBongSinhVien.DAO
{
    public class LoaiHB_NamHoc_DAO
    {
        dbConnection db = new dbConnection();
        public DataTable getAllLHBNH()
        {
            return db.ExecuteQuery("select * from LHB_NH");
        }

        public void them(string nh, string hb,string g)
        {
            SqlParameter[] mang = new SqlParameter[3];
            mang[0] = new SqlParameter("@manh", nh);
            mang[1] = new SqlParameter("@mahb", hb);
            mang[2] = new SqlParameter("@ghichu",g);
            db.ExecuteNonQuery("Them_LHBNH", mang);
        }

        public void sua(string nh, string hb, string g)
        {
            SqlParameter[] mang = new SqlParameter[3];
            mang[0] = new SqlParameter("@manh", nh);
            mang[1] = new SqlParameter("@mahb", hb);
            mang[2] = new SqlParameter("@ghichu", g);
            db.ExecuteNonQuery("Sua_LHBNH", mang);
        }
        public void xoa(string nh)
        {
            SqlParameter[] mang = new SqlParameter[1];
            mang[0] = new SqlParameter("@manh", nh); 
            db.ExecuteNonQuery("Xoa_LHBNH", mang);
        }

        public void TK_TheoMaNH(string nh)
        {
            SqlParameter[] mang = new SqlParameter[1];
            mang[0] = new SqlParameter("@manh", nh);
            db.ExecuteNonQuery("TimKiem_MaNHLHBNH", mang);
        }

        public void TK_TheoMaHB(string hb)
        {
            SqlParameter[] mang = new SqlParameter[1];
            mang[0] = new SqlParameter("@mahb", hb);
            db.ExecuteNonQuery("TimKiem_MaHBLHBNH", mang);
        }
       
    }
}
